package com.lkd.feign;

import com.lkd.feign.fallback.VmServiceFallbackFactory;
import com.lkd.vo.ChannelVO;
import com.lkd.vo.SkuVO;
import com.lkd.vo.VmVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "vm-service",fallbackFactory = VmServiceFallbackFactory.class)
public interface VmServiceFeignClient {

    /**
     * 根据编号查询售货机
     * @param innerCode
     * @return
     */
    @GetMapping("/vm/vmInfo/{innerCode}")
    VmVO getvmInfoByInnerCode(@PathVariable(name = "innerCode")String innerCode);

    /**
     * 根据售货机编号查询skulist
     * @param innerCode
     * @return
     */
    @GetMapping("/sku/getSkuListByInnerCode/{innerCode}")
    List<SkuVO> getSkuListByInnerCode(@PathVariable(name = "innerCode")String innerCode);

    /**
     * 查询当前sku是否有库存
     * @param innerCode
     * @param skuId
     * @return
     */
    @GetMapping("/channel/hasCapacity")
    ChannelVO hasCapacity(@RequestParam(name = "innerCode") String innerCode,
                                 @RequestParam(name = "skuId") Long skuId);
}
